1. Field of the Invention
The present invention relates to an inference processor in a production system which may be used as an expert system in the field of artificial intelligence.
2. Description of the Prior Art
A number of expert systems which apply artificial intelligence technologies have been developed to implement on computers the specialized and experiential knowledge of specialists in one or more fields to the resolution of specific problems. A large proportion of these systems are known as production systems, and express expert knowledge using rules with an if-then condition-conclusion logic structure.
A typical production system is described below with reference to FIGS. 1 and 2.
FIG. 1 shows the construction of a conventional compile-type inference processor (production system). In FIG. 1, 72 is a rule file used to store expert knowledge as rules in the file; 73 is a rule compiler which compiles the rules written to the rule file 72 into a network of rules to enable high speed inference processing using these rules; 74 is a production memory used to store the network and the intermediate status of inference process; 75 is a working memory for storing the intermediate results of inference processing; and 76 is an inference engine. The inference engine 76 stores the procedure which recognizes rules matching with the status of the working memory 75, and updates the production memory 74 and the working memory 75 by rule execution.
A production system thus constructed operates as described below. The knowledge believed to be applied by an expert in executing his daily tasks is collected by knowledge engineer (KE) through interviews and other methods, formulated into a series of if-then structure rules, and stored in the rule file 72. In order to construct a practical production system that is made up of these rules, it is necessary to minimize the amount of time required for the inference process. This is accomplished by using the rule compiler 73 to compile rules into a network and to generate the means for operating this network. The most efficient and widely used algorithm in these rule compilers is the Rete Match Algorithm (cf. Forgy, C. L.: Rete: A Fast Algorithm for the Many Pattern/Many Object Pattern Matching Problem, Artificial Intelligence 19, 1982). The Rete Match Algorithm shares conditional elements which happen to appear in some parts of rules, generates a network holding memory to store the intermediate states of inference processing, and stores this network in the production memory 74 in order to enable high speed evaluation of the If part of the rules. The inference engine 76 is generated as a means of processing this generated network at high speed. The inference engine 76 is a means of recognizing applicable rules at high speed by applying updated (modified) data in the working memory 75 to the network in the compiled production memory 74 one at a time as tokens, and updating the contents of the production memory 74 or the status of the network in the production memory 74 by invoking one of the rules to advance the inference process.
FIG. 2 depicts the construction of a conventional interpreter-type inference (production) system.
In FIG. 2, 77 is a rule file which stores expert knowledge formulated as rules; 78 is a rule interpreter/manager which interprets the rules in the rule file 77 in a memory of a computer; 79 is a production memory used to store the interpreted rules; 80 is a working memory which stores the intermediate results of inference processing; and 81 is an inference engine which recognizes rules in the production memory 79 that match the status of the working memory 80, and contains the procedures for updating the production memory 79 and the working memory 80 by applying those rules. A production system thus constructed operates as described below.
The knowledge believed to be applied by an expert in executing his daily tasks is gathered by knowledge engineer (KE) through interviews and other methods, formulated into a series of if-then structure rules, and stored in the rule file 77; this is the same as applies to the compiled rule processor described above. In order to make an inference using these rules and dynamically handle the rules during the inference procedure, the rule interpreter/manager 78 is used to expand rules into a network or list in the production memory 79. The inference engine 81 is a general-purpose means of referencing the generated production memory 79 and working memory 80, and is constant regardless of the contents of the production memory 79. When the inference engine 81 recognizes an applicable rule, the production memory 79 and the working memory 80 are updated by invoking that rule, thus advancing the inference procedure.
However, a compiled rule processor as shown in FIG. 1 achieves high speed inference processing by first converting all rules representing the knowledge used in the inference process to a network by means of a rule compiler 73 to efficiently manage the rules. This creates the problem of making it difficult to change the knowledge that is used for inference processing during execution of the inference process. The reasons for this are described below.
Specifically, in order to enable high speed inference processing, the inference engine 76 contains a procedure enabling high speed processing of a network into which the rules included in the rule file 72, which is the object of the inference operation, are compiled, rather than a general-purpose procedure defining the processing sequence for a general network. Therefore, it is necessary to change the procedure of the inference engine 76 itself, convert the procedure to a computer executable form and link it to other procedures being executed in order to continue inference processing without causing inferential contradictions while changing the rules during inference processing, but this process is extremely complicated.
With the construction as shown in FIG. 2, the use of a general-purpose inference engine 81 makes knowledge changes relatively simple but at the cost of a significant decrease in the speed of inference processing compared with the compiled rule processor described above. The reasons for this decrease are described below.
Specifically, with the inference engine 76 in a compiled inference processor wherein the inference engine 76 is restricted to specific inference rules, when there is a change in the data in the working memory 75, all rules affected by this change can be completely extracted before inference processing begins for all data in the working memory 75, thereby eliminating the need for unnecessary examinations during the inference process. However, in a general-purpose inference engine 81, it is not possible to obtain this information relating to the rules in advance of inference processing, thereby increasing the number of examinations required during inference processing and making it difficult to enable high speed inference processing.